﻿@model IEnumerable<Mvc4.Models.ShowModel>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<div>Page @(ViewBag.Page) of @(ViewBag.Pages) @if (ViewBag.Page > 1)
                                                  {
                                                      @Html.ActionLink("Prev",MVC.Episode.Index((int)(ViewBag.Page-1),(int)ViewBag.PageSize))
                                                  } @if (ViewBag.Page < ViewBag.Pages) 
                                                  {
                                                      @Html.ActionLink("Next",MVC.Episode.Index((int)(ViewBag.Page+1),(int)ViewBag.PageSize))
                                                  }</div>
<table>
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.ShowID)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.ShowName)
        </th>
        <th>@Html.DisplayNameFor(model => model.Imdb)</th>
        <th></th>
    </tr>

@foreach (var item in Model.OrderBy(m=>m.ShowName)) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.ShowID)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.ShowName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Imdb)
        </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new {id= item.ShowID }) |
            @Html.ActionLink("Details", "Details", new {id= item.ShowID }) |
            @Html.ActionLink("Delete", "Delete", new {id= item.ShowID })
        </td>
    </tr>
}

</table>
